package cn.ciis.sys.loginlog;

import cn.ciis.sys.account.AccountAdminService;
import cn.ciis.sys.permission.Notes;
import cn.ciis.sys.permission.Remark;
import cn.ciis.basic.base.BaseController;
import com.jfinal.aop.Inject;
import com.jfinal.kit.Kv;
import com.jfinal.plugin.activerecord.Record;

/** @author 冉志林 */
public class LoginLogAdminController extends BaseController {

  @Inject
  LoginLogAdminService srv;
  @Inject
  AccountAdminService accountAdminService;

  @Notes(value = "登陆日志管理")
  @Remark(value = "登陆日志列表")
  public void index(Integer accountId) {
    Kv kv = Kv.create();
    if (accountId != null) {
      kv.set("accountId", accountId);
    }
    set("accountList",accountAdminService.getListAccount());
    kRecord(
        new Record().set("accountId", accountId),
        srv.pageinate(getInt(PAGENUMBER, 1), getInt(PAGESIZE, 10), kv, "sys_login_log.page"));
  }

  @Remark(value = "登陆日志清空")
  public void clearLoginLog() {
    renderJson(srv.clearLoginLog());
  }
}
